﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.Xpo;

namespace Component.business.User
{
    public class UserDB:Base
    {
        //public static XPCollection<Users> GetAll(bool admin)
        //{
        //    XPCollection<Users> _xp = new XPCollection<Users>(KetNoiCSDL.session);
        //    _xp.Filter = FilterAll(admin);
        //    return _xp;
        //}

        public static Users GetObjectById(int id, bool admin)
        {
            XPCollection<Users> _xp = new XPCollection<Users>(KetNoiCSDL.session);
            _xp.Filter = FilterById(id, admin);
            try
            {
                return _xp[0];
            }
            catch
            { return new Users(KetNoiCSDL.session); }
        }
    }
}
